home *** CD-ROM | disk | FTP | other *** search
/ Chip 2011 November / CHIP_2011_11.iso / Programy / Narzedzia / PeaZip / peazip-3.9.WINDOWS.exe / {app} / res / zpaq / readme.txt < prev    next >
Encoding:
Text File  |  2009-06-15  |  12.0 KB  |  320 lines

  1. README for ZPAQ v1.02
  2. Matt Mahoney - June 14, 2009, matmahoney (at) yahoo (dot) com.
  3.  
  4. ZPAQ is a configurable file compressor and archiver. Its goal
  5. is a high compression ratio in an open format without loss of
  6. compatibility between versions as advanced compression techniques
  7. are discovered.
  8.  
  9. Versions 1.00 and higher are compatible with the ZPAQ level 1
  10. standard, which was first released Mar. 12, 2009.
  11. The latest version can be found at http://cs.fit.edu/~mmahoney/compression
  12.  
  13. There are two programs. unzpaq1 is a reference decompressor.
  14. It is an integral part of the standard. zpaq is both a compressor
  15. and decompressor. It is not part of the standard.  Unzpaq1 works
  16. like zpaq except that it understands only the x (extract) and l
  17. (list) commands.
  18.  
  19. Compression requires a configuration file. Three examples are
  20. supplied:
  21.  
  22.   min.cfg - Fast, minimal compression (LZP + order 3). Requires 4 MB memory.
  23.   mid.cfg - Average compression and speed. Requires 111 MB.
  24.   max.cfg - Slow but good compression. Requires 278 MB.
  25.  
  26. To create an archive:
  27.  
  28.   zpaq cconfig archive files...
  29.  
  30. where config is a configuration file, archive is the compressed
  31. file to create, and files... are the files to compress. There
  32. should be no space between the "c" command and the file name. For
  33. example:
  34.  
  35.   zpaq cmax.cfg calgary.zpaq calgary\*
  36.  
  37. will compress the Calgary corpus (14 files) as follows
  38. in 45 seconds on a 2 GHz Pentium T3200. The file names are
  39. stored in the archive as given on the command line.
  40.  
  41. 278.474 MB memory required.
  42. calgary\BIB 111261 -> 23006
  43. calgary\BOOK1 768771 -> 198711
  44. calgary\BOOK2 610856 -> 123700
  45. calgary\GEO 102400 -> 46772
  46. calgary\NEWS 377109 -> 90672
  47. calgary\OBJ1 21504 -> 8814
  48. calgary\OBJ2 246814 -> 56107
  49. calgary\PAPER1 53161 -> 11198
  50. calgary\PAPER2 82199 -> 17135
  51. calgary\PIC 513216 -> 28726
  52. calgary\PROGC 39611 -> 9119
  53. calgary\PROGL 71646 -> 11022
  54. calgary\PROGP 49379 -> 7943
  55. calgary\TRANS 93695 -> 11623
  56. -> 644548
  57.  
  58. To append to an existing archive:
  59.  
  60.   zpaq aconfig archive files...
  61.  
  62. To append without saving a SHA1 checksum (saves 20 bytes per file):
  63.  
  64.   zpaq bconfig archive files...
  65.  
  66. If a checksum is present, the decompressor will compute the SHA1
  67. hash of the extracted file and compare it with the stored checksum
  68. and report a warning if they don't match.
  69.  
  70. To list the contents of an archive:
  71.  
  72.   zpaq l archive
  73.   unzpaq1 l archive
  74.  
  75. This shows the file names and sizes before and after compression
  76. and the memory required to extract. To list verbosely:
  77.  
  78.   zpaq v archive
  79.  
  80. This also shows the model used to compress and the ZPAQL program
  81. used to compute the contexts from the original config file. The
  82. config file is not needed to extract.
  83.  
  84. To extract files using the stored file names:
  85.  
  86.   zpaq x archive
  87.   unzpaq1 x archive
  88.  
  89. If the files to be extracted already exist, then zpaq will
  90. refuse to clobber them and skip to the next file. If the files
  91. are compressed with a path (folder or directory), then that
  92. directory must exist when the file is extracted. zpaq will
  93. not create directories.
  94.  
  95. To extract and rename:
  96.  
  97.   zpaq x archive files...
  98.   unzpaq1 x archive files...
  99.  
  100. Files are extracted in the same order they are saved and renamed.
  101. Unlike using stored names, if the file exists, then it is
  102. overwritten (clobbered). Only files named on the command line
  103. are extracted. Any additional files in the archive are ignored.
  104. For example:
  105.  
  106.   zpaq x calgary.zpaq foo bar
  107.  
  108. will extract BIB to foo, BOOK1 to bar, and then stop.
  109.  
  110. The following commands are useful for debugging or developing
  111. config files:
  112.  
  113.   zpaq t archive [files...]
  114.  
  115. Extracts files like x, but without post-processing.
  116.  
  117.   zpaq hconfig [args...]
  118.  
  119. Displays config, then executes the HCOMP section (a program written
  120. in ZPAQL; see the ZPAQ specification) as a context hash function
  121. once for each argument as input. args... should be decimal numbers.
  122. For each argument, the value is loaded into the A register and
  123. the program is run with each execution step displayed along
  124. with the contents of registers. At the end of each execution,
  125. the entire machine state (M and H arrays) is dumped to the
  126. screen.
  127.  
  128.   zpaq pconfig [input [output]]
  129.  
  130. Runs config as a postprocessing program. The program is run
  131. once for each byte of input, with output redirected to the
  132. named output file. At the end of input, the program is run
  133. with input 2^32-1 to signal EOF. The defaults are standard
  134. input and standard output.
  135.  
  136.   zpaq sconfig
  137.  
  138. Compiles config and outputs HCOMP as a list of numbers suitable
  139. for initializing an array in C/C++
  140.  
  141. A config file has the format:
  142.  
  143.   comp hh hm ph pm n
  144.     (numbered list of components from 0 to n-1)
  145.   hcomp
  146.     (program to compute context hashes)
  147.   post
  148.     (post-processing options)
  149.   end
  150.  
  151. The file is case-insensitive, and free-format (all whitespace
  152. is equivalent). Comments may be written in parenthesis and
  153. may be nested. See min.cfg and max.cfg for examples. See the
  154. ZPAQ specification for descriptions of components and ZPAQL
  155. instructions. Notes:
  156.  
  157. - Operands of 2 byte instructions must be separated by a space.
  158.   For example, "A=0" is one byte, "A= 0" is 2 bytes. "A=1" is
  159.   not valid because there is no 1 byte opcode for it. It must
  160.   be written "A= 1".
  161. - JT, JF, and JMP accept operands in the range (-128...127).
  162. - LJ (long jump) accepts an operand in the range (0...65535).
  163.   It is coded as 2 bytes, LSB first. This is the only 3 byte
  164.   instruction.
  165. - All other numeric operands must be in the range (0...255).
  166.  
  167. The hconfig command runs the program in the HCOMP section using
  168. arrays H and M with sizes 2^hh and 2^hm respectively. The pconfig
  169. command uses 2^ph and 2^pm respectively.
  170.  
  171. When developing a config file, it is useful to run with the
  172. hconfig command without arguments to check for compilation
  173. errors and check the targets of relative jump instructions
  174. (which are displayed as absolute). Once it is correct, it can
  175. be run again with arguments so that you can check if the program
  176. is behaving correctly.
  177.  
  178. The following POST commands are accepted:
  179.  
  180.   0 (no preprocessing)
  181.   x (E8E9 transform for better .exe and .dll compression)
  182.   p esc minlen hmul (LZP transform)
  183.  
  184. The 0 transform compresses the file unchanged. Set ph=0, pm=0 to
  185. save memory.
  186.  
  187. The x transform improves x86 compression by replacing the relative
  188. addresses of the CALL and JMP instructions (0xE8 and 0xE9) with
  189. absolute addresses by adding the offset from the start of the file
  190. to the 4 byte number (LSB first) that follows the instruction.
  191. When used, set ph=0, pm=3.
  192.  
  193. The p transform performs a simple, fast compression that improves
  194. speed by replacing duplicate, consecutive strings that occur in the
  195. same context with a code to indicate the length of the match. The
  196. sequence (esc len), len > 0, codes a match of length len+minlen.
  197. The sequence (esc 0) codes esc. The context hash is updated for
  198. each byte C by: hash := hash * hmul + C (mod 2^ph). The match
  199. must be found in a rotating buffer of size 2^pm. For example:
  200.  
  201.   comp x x 18 20 x (ph=18, pm=20)
  202.     ...
  203.   post
  204.     p 127 3 40
  205.   end
  206.  
  207. says to code matches using escape bytes with the value 127. Match
  208. lengths are in the range (4...258). This uses an order 6 context hash
  209. because 40 = 5*2^3 effectively shifts the context hash left by 3 bits
  210. and ph/3 = 18/3 = 6.
  211.  
  212. LZP helps speed at the expense of compression for all but the fastest
  213. configurations (e.g. min.cfg). It is recommended to use esc = any
  214. value that rarely occurs in the input, minlen = 3 or more, hmul to
  215. select a context of order < minlen, pm = ph + 2 and pm > 8. Allowed
  216. values are (0...255).
  217.  
  218. Contents:
  219.  
  220.   zpaq100.pdf -  Version 1.00 of the ZPAQ specification. It became
  221.                  standard on Apr. 11, 2009 because it was not
  222.                  superceded by a newer version for 30 days after release.
  223.  
  224.   unzpaq102.cpp -Reference standard decompressor. It is
  225.                  part of the specification.
  226.  
  227.   unzpaq.exe -   32 bit Windows executable, compiled as follows with
  228.                  MinGW g++ 4.4:
  229.                  g++ -O2 -s -fomit-frame-pointer -march=pentiumpro \
  230.                    -DNDEBUG zpaq.cpp -o zpaq.exe
  231.                  upx zpaq.exe
  232.  
  233.   zpaq.cpp -     Compressor source code, not a part of the standard.
  234.                  Compiled as above.
  235.  
  236.   zpaq.exe -     32 bit Windows executable.
  237.  
  238.   min.cfg -      Config file for fast compression.
  239.  
  240.   mid.cfg -      Config file for average compression.
  241.  
  242.   max.cfg -      Config file for good compression.
  243.  
  244.   readme.txt -   This file
  245.  
  246. Changes:
  247.  
  248. v0.01 - Feb. 15, 2009. Original release. Conforms to v0.29 of spec.
  249.         except does not support postprocessing.
  250.  
  251. v0.02 - Feb. 18, 2009. Adds R=X, X=R, and LJ
  252.         instructions and R[256] register. Removes .= instruction.
  253.         Spaces are required before ZPAQL operands. Adds end of segment
  254.         signal to decoder. Adds "x" transform (E8E9). PASS transform
  255.         is changed to "0". Adds a header byte to describe HCOMP
  256.         language. Not compatible with v0.01. Conforms to v0.32 of spec.
  257.         Current max.cfg does poorly with maximumcompression.com.
  258.         Expect more changes.
  259.  
  260. v0.03 - Feb. 19, 2009. Fixed MIX, MIX2, and IMIX spec. to reduce overflow,
  261.         which resulted in poor compression of large files. Modified
  262.         stretch function for better compression.
  263.  
  264.         Block 1: requires 314.476 MB memory (with POST X to turn on E8E9)
  265.           maxcomp\a10.jpg  842468 -> 829159
  266.           maxcomp\acrord32.exe  3870784 -> 1154882
  267.           maxcomp\english.dic  4067439 -> 476099
  268.           maxcomp\FlashMX.pdf  4526946 -> 3649140
  269.           maxcomp\fp.log  20617071 -> 432826
  270.           maxcomp\mso97.dll  3782416 -> 1545417
  271.           maxcomp\ohs.doc  4168192 -> 757538
  272.           maxcomp\rafale.bmp  4149414 -> 763314
  273.           maxcomp\vcfiu.hlp  4121418 -> 499321
  274.           maxcomp\world95.txt  2988578 -> 441130
  275.         53,134,726 -> 10,548,826
  276.  
  277. v0.04 - Feb. 21, 2009. Fixed train() spec. to fix poor compression with
  278.         SSE and possibly other components. Modifed squash() for better
  279.         compression. New max.cfg.
  280.  
  281. v0.05 - Feb. 26, 2009. Changed representation of squashed probabilities
  282.         to 15 bits (0..32767) and stretched to 6 bit scale in (-2048..2047),
  283.     and mixer weights to 20 bit signed numbers. Mixers are now guaranteed
  284.     not to overflow. The higher resolution improves compression on highly
  285.     redundant files. MIX2 now has weights constrained to add to 1 which
  286.     also improves compression.
  287.  
  288. v0.06 - Feb. 27, 2009. Optionally appends a SHA1 hash of the input file
  289.     for each segment, which is checked by the decompressor. Added
  290.     "b" command to append without a checksum. Replaced IMIX2 with
  291.     ISSE. Compression prints memory usage by component.
  292.  
  293. v0.07 - Feb. 28, 2009. Modified ISSE to use decreasing learning rate
  294.         on the fixed size inversely proportional to a count. ISSE drops the
  295.         c and rate parameters. SSE drops the mask parameter. Bit history
  296.         next-state tables are updated by removing some of the n0=0 or n1=0
  297.         states and adding other states.
  298.  
  299. v0.08 - Mar. 8, 2009. Added LZP preprocessor. Improved memory utilization
  300.         reporting. Minor speed improvements. Added mid.cfg. Changed
  301.         MATCH so that the buffer and hash table sizes are specified
  302.         separately. Clarified role of comment field. Removed zpaqd.exe.
  303.  
  304. v0.09 - Mar. 9, 2009. Removed counters from ISSE and ICM and replaced
  305.         bit history map with initial estimates based on n1/(n0+n1) to
  306.         improve speed. Fixed a bug where x clobbers files when it says
  307.         it isn't.
  308.  
  309. v1.00 - Mar. 12, 2009. First level 1 candidate. Simplified the
  310.         bit history tables and replaced with code to generate them
  311.         in both the documentation and code. First release of the
  312.         reference standard unzpaq1 v1.00. Improved compression on 
  313.         some files.
  314.  
  315. v1.01 - Apr. 27, 2009. Updated unzpaq to fix VS2005 compiler issues.
  316.  
  317. v1.02 - June 14, 2009. Updated zpaq and unzpaq to close files
  318.         immediately after extraction instead of when program exits.
  319.         Fixed g++ 4.4 compiler warnings.
  320.